PBOpenDFSync
PBOpenDF
Open the data fork of a file OSErr PBOpenDF(pb, async ); Boolean async ; 0=await completion; 1=immediate return Use the PBOpenDF function to open the data fork of a file. PBOpenDF
replaces PBOpen, which can open either a driver or the data fork of a file. pb is a pointer to a IOParam structure.The relevant fields are as follows:
Æ ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) ¨ ioResult short 2 16 Error Code (0=no error, 1=not done yet)
Æ ioNamePtr StringPtr 4 18 pointer to file or directory name Æ ioVRefNum short 2 22 Volume reference
¨ ioRefNum short 2 24 access path number
Æ ioPermssn char 1 27 permission
async is a Boolean value. Use FALSE for normal (synchronous) operation or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
nsvErr (-35) Volume not found
ioErr (-36) I/O error
bdNamErr (-37) Bad filename
tmfoErr (-42) Too many files open
fnfErr (-43) File not found
opWrErr (-49) File already open for writing
extFSErr (-58) External file system
Notes: PBOpenDF creates an access path to the data fork of a file. It is almost
identical to PBOpen. The difference is that PBOpen can open both files and drivers, but PBOpenDF can open only files. Using OpenDF instead of FSOpen when your application is opening a file prevents naming conflicts or ambiguities and ensures that your application can open files whose names
begin with a period (.).
PBOpenDF takes a permission parameter
In most cases, you can simply set the permission parameter to fsCurPerm.
Some applications request fsRdWrPerm, to ensure that they can both read
and write to a file. The constants that can be passed in this field are the
following:
fsCurPerm exclusive read/write permission if it is available;
otherwise, exclusive read, if that is available
fsRdPerm exclusive read permission
fsWrPerm exclusive write permission
fsRdWrPerm exclusive read/write permission
fsRdWrShPerm shared read/write permission
In shared environments, permission requests are translated into the
"deny-mode" permissions defined by AppleShare.